import request from '../utils/request'
// import store from '../store'
const projectId = sessionStorage.projectId
const projectid = sessionStorage.projectId
export function getProjectPage(pageSize, pageNo, name) {
  return request({
    url: '/project/get/page',
    method: 'post',
    qs: true,
    data: {
      pageSize,
      pageNo,
      name
    }
  })
}

// 根据id获取项目详情
export function folderTree(name) {
  return request({
    url: '/folder/tree',
    method: 'get',
    params: { projectid, name }
  })
}

export function folderChildren( level, name, folderId, sort, pageIndex, pageSize) {
    return request({
        url: '/folder/child/content',
        method: 'get',
        params: { projectId,  level, name, folderId, sort, pageIndex, pageSize }
    })
}

export function folderAdd(parentId, name, level) {
  return request({
    url: '/folder/add',
    method: 'post',
    data: { parentId, name, level, projectId }
  })
}

export function folderDelete(folderId) {
  return request({
    url: '/folder/recycle/' + folderId,
    method: 'get'
  })
}

// 判断文件夹是否同名
export function folderJudge(parentId, name) {
  return request({
    url: '/folder/judge',
    method: 'post',
    data: { parentId, name, projectId }
  })
}

export function folderRename(parentId, name, id) {
  return request({
    url: '/folder/rename',
    method: 'post',
    data: { parentId, name, id }
  })
}
